package cn.fighter3.controller;

import cn.fighter3.dto.QueryDTO;
import cn.fighter3.entity.Iplog;
import cn.fighter3.entity.User;
import cn.fighter3.result.Result;
import cn.fighter3.service.IplogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class IplogController {
    @Autowired
    private IplogService iplogService;
    /**
     * 分页查询
     * @param queryDTO
     * @return
     */
    @PostMapping("/api/iplog/list")
    public Result iplogList(@RequestBody QueryDTO queryDTO){
        return new Result(200,"",iplogService.selectIplogPage(queryDTO));
    }

    /**
     * 添加
     * @param iplog
     * @return
     */
    @PostMapping("/api/iplog/add")
    public Result addIplog(@RequestBody Iplog iplog){
        return new Result(200,"",iplogService.addIplog(iplog));
    }


    /**
     * 删除
     * @param id
     * @return
     */
    @PostMapping("/api/iplog/delete")
    public Result deleteIplog(Integer id){
        return new Result(200,"",iplogService.deleteIplog(id));
    }

    /**
     * 批量删除
     * @param ids
     * @return
     */
    @PostMapping("/api/iplog/delete/batch")
    public Result batchDeleteIplog(@RequestBody List<Integer> ids){
        iplogService.batchDelete(ids);
        return new Result(200,"","");
    }

}
